home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / lib.fmt / c / strtol.man < prev    next >
Encoding:
Text File  |  1989-04-16  |  3.3 KB  |  135 lines

  1.  
  2.  
  3.  
  4. strtol                    User Commands                    strtol
  5.  
  6.  
  7.  
  8. _________________________________________________________________
  9.  
  10. NNAAMMEE
  11.      strtol, strtoul - Convert character string to integer
  12.  
  13. SSYYNNOOPPSSIISS
  14.      ##iinncclluuddee <<ssttddlliibb..hh>>
  15.  
  16.      lloonngg iinntt
  17.      ssttrrttooll((_s_t_r_i_n_g, _e_n_d_P_t_r, _b_a_s_e)
  18.  
  19.      uunnssiiggnneedd lloonngg iinntt
  20.      ssttrrttoouull((_s_t_r_i_n_g, _e_n_d_P_t_r, _b_a_s_e)
  21.  
  22. AARRGGUUMMEENNTTSS
  23.      char     *_s_t_r_i_n_g  (in)      String     containing      ASCII
  24.                                  representation of integer.
  25.  
  26.      char     **_e_n_d_P_t_r (out)     If not NNUULLLL,  gives  address  of
  27.                                  pointer  to fill in with address
  28.                                  of  first  character  in  _s_t_r_i_n_g
  29.                                  following integer.
  30.  
  31.      int      _b_a_s_e     (in)      Base to use for conversion;  see
  32.                                  below  for explanation.  Must be
  33.                                  between 0 and 36, inclusive.
  34.  
  35. _________________________________________________________________
  36.  
  37.  
  38. DDEESSCCRRIIPPTTIIOONN
  39.      The ssttrrttooll and ssttrrttoouull procedures convert a character string
  40.      to  its  corresponding integer representation and return the
  41.      integer value.  Both procedures expect _s_t_r_i_n_g to point to  a
  42.      sequence  of  digits,  optionally  preceded by any amount of
  43.      white space (as defined by the iissssppaaccee  procedure).   SSttrrttooll
  44.      also  permits  the  digits  to  be preceded immediately by a
  45.      minus sign, in which case the result is a negative integer.
  46.  
  47.      If _b_a_s_e is between 2 and 36, inclusive, then the permissible
  48.      ``digits''  of  the string consist of the first _b_a_s_e charac-
  49.      ters in the set 00 through 99 and aa through zz  (or  AA  through
  50.      ZZ).  The integer result will be calculated using _b_a_s_e as the
  51.      radix for conversion.  If the value of _b_a_s_e is 16, then  the
  52.      characters  00xx  or  00XX may precede the digits, following the
  53.      sign if it is present.
  54.  
  55.      If _b_a_s_e is 0, then the radix for conversion is chosen  based
  56.      on  the initial digits of the number.  If the initial digits
  57.      are 00xx or 00XX, then base 16  will  be  used  for  conversion;
  58.      otherwise  if  the first digit is 00 then base 8 will be used
  59.      for conversion; otherwise base 10 will be used.
  60.  
  61.      SSttrrttooll and ssttrrttoouull convert as many  characters  as  possible
  62.  
  63.  
  64.  
  65. Sprite v.1.0        Printed:  April 15, 1989                    1
  66.  
  67.  
  68.  
  69.  
  70.  
  71.  
  72. strtol                    User Commands                    strtol
  73.  
  74.  
  75.  
  76.      from  _s_t_r_i_n_g, and return in *_e_n_d_P_t_r the address of the first
  77.      character not forming a valid portion of the number.  If  no
  78.      conversion  could be performed (_s_t_r_i_n_g was empty, or did not
  79.      point to a number in the expected form), then _s_t_r_i_n_g will be
  80.      stored in *_e_n_d_P_t_r and zero is returned.
  81.  
  82.  
  83. KKEEYYWWOORRDDSS
  84.      base, convert, integer, radix, string
  85.  
  86.  
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129.  
  130.  
  131. Sprite v.1.0        Printed:  April 15, 1989                    2
  132.  
  133.  
  134.  
  135.